package com.pro.controller;

import com.pro.pojo.*;
import com.pro.service.CommentService;
import com.pro.service.JsLogService;
import com.pro.utils.DateUtils;
import com.pro.utils.SensitiveWordsUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

@Controller
@RequestMapping("/JsLog")
public class JsLogController {

    @Autowired
    private JsLogService jsLogService;

    //查看商品操作日志
    @RequestMapping("/getProductJsLog")
    @ResponseBody
    public JsonData getProductJsLog(JsLog jsLog){
        List<JsLog> jsLog1 = jsLogService.getProductJsLog(jsLog);
        return jsLog1!=null?JsonData.buildSuccess(jsLog1):JsonData.buildError("服务器出错了");
    }

    //添加商品操作日志
    @RequestMapping("/addProductJsLog")
    @ResponseBody
    public JsonData addProductJsLog(JsLog jsLog){
        boolean b = jsLogService.addProductJsLog(jsLog);
        return b?JsonData.buildSuccess(b):JsonData.buildError("服务器出错了");
    }

    //删除商品操作日志
    @RequestMapping("/deleteProductJsLog")
    @ResponseBody
    public JsonData deleteProductJsLog(Integer logId){
        boolean b = jsLogService.deleteProductJsLog(logId);
        return b?JsonData.buildSuccess(b):JsonData.buildError("服务器出错了");
    }
    //添加商品操作日志
    @RequestMapping("/addJsLogMicroCircle")
    @ResponseBody
    public JsonData addJsLogMicroCircle(JsLog param){
        boolean b = jsLogService.addJsLogMicroCircle(param);
        return b?JsonData.buildSuccess(b):JsonData.buildError("服务器出错了");
    }
    //添加商品操作日志
    @RequestMapping("/deleteJsLogMicroCircle")
    @ResponseBody
    public JsonData deleteJsLogMicroCircle(Integer logId){
        boolean b = jsLogService.deleteJsLogMicroCircle(logId);
        return b?JsonData.buildSuccess(b):JsonData.buildError("服务器出错了");
    }
    //查询商品操作日志
    @RequestMapping("/getJsLogMicroCircle")
    @ResponseBody
    public JsonData getJsLogMicroCircle(JsLog param){
        List<JsLog> getJsLogMicroCircle = jsLogService.getJsLogMicroCircle(param);
        return getJsLogMicroCircle!=null?JsonData.buildSuccess(getJsLogMicroCircle):JsonData.buildError("服务器出错了");
    }

}
